package com.uns.um.ep.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DataBaseHelper extends SQLiteOpenHelper {

	private static final int DATABASE_VERSION = 1;
	public static final String DATABASE_NAME = "china_city.db";
	public static final String TABLE_NAME = "china_city";
	public static final String CC_PRIVOINCE = "province";
	public static final String CC_CITY = "city";
	public static final String CC_COUNTRY = "country";
	public static final String CC_CODE = "code";

	public DataBaseHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		String sql = "CREATE TABLE IF NOT EXISTS ";
		sql += TABLE_NAME;
		sql += "(_id integer PRIMARY KEY AUTOINCREMENT,";
		sql += CC_PRIVOINCE + " text,";
		sql += CC_CITY + " text,";
		sql += CC_COUNTRY + " text,";
		sql += CC_CODE + " integer ";
		sql += ")";
		db.execSQL(sql);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

	}
}
